#!/bin/bash
C="client"
C1_CFG="${C}1/${C}.cfg"
cd /opt/foldingathome/
if [ ! -f ${C1_CFG} ]; then
	echo "Client not yet configured, exiting"
	exit 1;
fi
sed -i -e 's/^\(team=\)0/\111298/' ${C1_CFG}
declare -i id=$(sed -e 's/^machineid=\([0-9]*\).*$/\1/p;d' ${C1_CFG})
for (( i=2; ${i}<=8; i=${i}+1 )); do
	id=$id+1
	sed -e "s/^\(machineid=\)[0-9]*/\1${id}/" ${C1_CFG} > ${C}${i}/${C}.cfg
done
